package cn.dwrService;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;



import cn.bean.HealthAcc;
import cn.bean.PageBean;
import cn.bean.UOrder;
import cn.service.ManagerService;
import cn.util.Common;
import cn.util.ReturnBean;
import cn.util.SqlUtil;

public class ChargeHisService {
	public ManagerService getManagerService() {
		return managerService;
	}
	public void setManagerService(ManagerService managerService) {
		this.managerService = managerService;
	}
	public LogService getMyLog() {
		return myLog;
	}
	public void setMyLog(LogService myLog) {
		this.myLog = myLog;
	}
	private ManagerService managerService;
	private LogService myLog;
	
	public ReturnBean qryChargeHis(PageBean page,UOrder cond,HttpServletRequest request){
		StringBuffer bu=new StringBuffer();
		HealthAcc acc=(HealthAcc)Common.getKeyValue("loginInfo", request);
		List<Object> param=new ArrayList<Object>();
		bu.append(SqlUtil.sqls[8]);
		if(!Common.isNull(cond.getBeginDate())){
			bu.append(" AND STATE_DATE>=?");
			param.add(cond.getBeginDate());
		}
		if(!Common.isNull(cond.getEndDate())){
			bu.append(" AND STATE_DATE<=?");
			param.add(cond.getEndDate());
		}
		if(!Common.isNull(cond.getState())){
			bu.append(" AND STATE=?");
			param.add(cond.getState());
		}
		bu.append(" AND LOGIN_ID=?");
		param.add(acc.getLoginId());
		UOrder o=new UOrder();
		o.setResultConfig(new String[]{"id","loginId","payType","payVal","money","state","tradeNo","stateDate"});
		return managerService.qryObjPage(page,bu.toString(),param,o);
	}
}
